#!/bin/bash
#TODO - use list for distribution check!
#distrolist="ubuntu centos freenas zeroshell"

#Validate user input and if not valid will ask the user for one.
if [ -z $1 ]; then
	while [ "$distro" != "ubuntu" ] && [ "$distro" != "centos" ]; do
		echo -n "Which distro do you want to download ($distrolist)?"
		read distro
	done;
else
	distro=$1
fi

#case switch for downloading the right ISO by distribution
case $distro in
"ubuntu")
	wget http://releases.ubuntu.com/14.04.1/ubuntu-14.04.1-server-amd64.iso
	echo "ubuntu"
	;;
"centos")
	wget http://centos.crazyfrogs.org/6.6/isos/x86_64/CentOS-6.6-x86_64-bin-DVD1.iso
	wget http://centos.crazyfrogs.org/6.6/isos/x86_64/CentOS-6.6-x86_64-bin-DVD2.iso
	echo "centos"
	;;
"zeroshell")
	wget http://mirror.switch.ch/ftp/mirror/zeroshell/ZeroShell-3.2.1.iso
	echo "zeroshell"
	;;
"freenas")
	echo "Downloading freenas"
	wget http://download.freenas.org/latest/latest/x64/FreeNAS-9.3-STABLE-201501151844.iso
	;;
*)
	echo "else"
	;;
esac
